How to get a new array with new data structure on conditions from the origin array

visit shbcf.ru